//package com.simga.simgalibrary.activity;
//
//import android.os.Bundle;
//import android.support.v7.widget.LinearLayoutManager;
//import android.support.v7.widget.RecyclerView;
//import android.widget.LinearLayout;
//
//import com.simga.simgalibrary.R;
//import com.simga.simgalibrary.widget.Divider;
//import com.simga.simgalibrary.widget.refreshlayout.RefreshLayout;
//import com.simga.simgalibrary.widget.refreshlayout.RefreshLayoutDirection;
//
//
///**
// * Created by longbh on 16/5/31.
// */
//public abstract class BaseListActivity extends BaseActivity {
//
//    protected RecyclerView mListView;
//    public RefreshLayout mRefreshLayout;
//    protected LinearLayout mLlRoot;
//    protected int mPageNumber = 1;
//
//    @Override
//    protected int getViewId() {
//        return R.layout.activity_base_list;
//    }
//
//    @Override
//    protected void init(Bundle savedInstanceState) {
//        mListView = (RecyclerView) findViewById(R.id.list);
//        mRefreshLayout = (RefreshLayout) findViewById(R.id.ref_layout);
//        mLlRoot = (LinearLayout) findViewById(R.id.ll_root);
//        mRefreshLayout.setColorSchemeResources(R.color.main_color);
//        mRefreshLayout.setOnRefreshListener(new RefreshLayout.OnRefreshListener() {
//            @Override
//            public void onPullDownToRefresh() {
//                mPageNumber = 1;
//                loadPageData(mPageNumber);
//            }
//
//            @Override
//            public void onPullUpToRefresh() {
//                mPageNumber++;
//                loadPageData(mPageNumber);
//            }
//        });
//
//        mListView = (RecyclerView) findViewById(R.id.list);
//        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(mContext);
//        mListView.setLayoutManager(layoutManager);
//        mListView.setHasFixedSize(true);
//        mListView.setAdapter(getAdapter());
//        if (isAddItemDecoration()) {
//            mListView.addItemDecoration(new Divider(mContext));
//        }
//        getDataRequest();
//
//    }
//
//    protected void setBackgroundColor(int res){
//        if(mLlRoot!=null){
//            mLlRoot.setBackgroundResource(res);
//        }
//    }
//
//    public boolean isAddItemDecoration() {
//        return false;
//    }
//
//    public abstract void loadPageData(int page);
//    public abstract void getDataRequest();
//
//    public abstract RecyclerView.Adapter getAdapter();
//
//    public void onLoad(int size) {
//        if (mRefreshLayout == null) {
//            return;
//        }
//        if (mRefreshLayout.isRefreshing()) {
//            mRefreshLayout.setRefreshing(false);
//        }
//        if (size < 10) {
//            mRefreshLayout.setDirection(RefreshLayoutDirection.TOP);
//        } else {
//            mRefreshLayout.setDirection(RefreshLayoutDirection.BOTH);
//        }
//    }
//}
